from flask import render_template, redirect, url_for
from flask_login import current_user
from . import main

@main.route('/')
def index():
    if current_user.is_authenticated:
        if current_user.role == 'admin':
            return redirect(url_for('user.user_management'))
        return redirect(url_for('gesture.recognition'))
    return redirect(url_for('auth.login_route'))

@main.route('/profile')
def profile():
    return render_template('profile.html', user=current_user) 